<template>
  <div>
    <el-card>
    <el-table ref="rightTable" :data='allRightList' style="width:100%">
      <el-table-column type="index" label="索引"></el-table-column>
      <el-table-column property="authName" label="权限名称"></el-table-column>
      <el-table-column property="path" label="路径"></el-table-column>
      <el-table-column property="level" label="权限等级">
        <template v-slot='scope'>
          <el-tag  v-if="scope.row.level === '0'">一级权限</el-tag>
          <el-tag type="success" v-else-if="scope.row.level === '1'">二级权限</el-tag>
          <el-tag v-else type="warning">三级权限</el-tag>
        </template>
      </el-table-column>
    </el-table>
     </el-card>
  </div>
</template>

<script>
import { getAllUserRightsApi } from '@/Utils/Api/getUserRightApi'
export default {
  name: 'RightView',
  data () {
    return {
      type: 'list',
      allRightList: []
    }
  },
  components: {},
  created () {
    this.getAllUserRights()
  },
  mounted () {},
  methods: {
    async getAllUserRights () {
      const { data } = await getAllUserRightsApi(this.type)
      if (data.meta.status !== 200) {
        return this.$message({
          type: 'error',
          message: data.meta.msg
        })
      }
      this.allRightList = data.data
      this.$message({
        type: 'success',
        message: data.meta.msg
      })
    }
  },
  computed: {},
  watch: {}
}
</script>

<style scoped>
</style>
